package com.lanyanhua.job.job;

import com.lanyanhua.job.entity.JobLog;
import com.lanyanhua.job.utils.DingDingUtils;
import lombok.extern.slf4j.Slf4j;
import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;


/**
 * @Auther: lanyanhua
 * @Date: 2018/12/27 0027 14:32
 * @Description:
 */
@Slf4j
public class DingDingJob extends EmailErrorCountJob {

    private String context;
    @Override
    public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException {
        super.execute(jobExecutionContext);
        //发送订单消息

        if(isSend()){
            log.info("=======推送钉钉消息===========");
            String userId = "";
            context ="项目："+jobInfo.getJobGroup()+"，定时任务：" + jobInfo.getJobName()+"\r\n"+context;
            DingDingUtils dingUtils = new DingDingUtils();
            dingUtils.sendDingdingMsg(userId,context);
            log.info("=======发送完成===============");
        }
    }

    @Override
    public String getEmailContent(JobLog jobLog) {
        context = super.getEmailContent(jobLog);
        return context;
    }
}
